<?php

namespace app\index\controller;

use app\BaseController;
use app\IndexBaseController;
use think\facade\Db;
use think\facade\fetch;
use think\App;
use think\facade\View;

class Index extends BaseController
{
    //继承
    public function __construct(App $app)
    {
        parent::__construct($app);
    }

    //登录
    public function login()
    {
        return view('login');
    }

    //注册用户
    public function register()
    {
        return view('register');
    }

    //首页
    public function index()
    {
        $goodslists = Db::name('goods')->where(['deleted'=>0,'display'=>1])->select()->toArray();
        return view('index',['goodslists'=>$goodslists]);
    }

    //关于我们
    public function about()
    {
//        var_dump('1110');exit;
        return view('about');
    }

    //联系我们
    public function contact()
    {
//        var_dump('1110');exit;
        return view('contact');
    }

    //产品详情
    public function product_details()
    {
        $param = $this->_param;
        $goods_details = Db::name('goods')->where(['id'=>$param['id']])->find();
       // var_dump($goods_details);exit;
        return View::fetch('product_details',['goods'=>$goods_details]);
    }

    //评价
    public function feedback()
    {
        return View::fetch();
    }

    //注册批发商
    public function register_wholesale() {
        return View::fetch();
    }

    //注册批发商
    public function wholesale() {
        return View::fetch();
    }

    //购物车
    public function order_cart()
    {
        return View::fetch('order_cart');
    }

    //结算页面
    public function checkout()
    {
        return View::fetch('checkout');
    }

    //订单列表
    public function order_list()
    {
        return View::fetch('order_list');
    }

    //订单详情
    public function details()
    {
        return View::fetch();
    }

}
